

import 'package:dio/dio.dart';
import 'package:lcapp/api/interface/home_api.dart';
import 'package:lcapp/api/request/response_data.dart';


class AddressInfo {
  static Map address = {};
  static List plList = [];
  static Future<Map> getAddress()async{
    if(address.isNotEmpty){
      return address;
    }
    Response res = await  Dio().get('https://restapi.amap.com/v3/config/district?&subdistrict=3&extensions=base&key=df9eba155edb125fc2c4e3a6a91ac4df');
    address = res.data;
    return address;
  }

  static Future<List> getPlList()async{
    if(plList.isNotEmpty){
      return plList;
    }
    ResponseData res = await HomeAPI.getXianTypes();
    if(res.code==200){
      plList.clear();
      List arr = res.data??[];
      for (var element in arr) {
        plList.add(element);
      }
    }
    return plList;
  }
}